package structural.composite;

//组合模式
public class Test {
    public static void main(String[] args) {
        CatalogComponenet linuxCourse = new Course("Linux课程","11");
        CatalogComponenet windowsCourse = new Course("Windows课程","11");

        CatalogComponenet javaCourseLog = new CourseCatalog("java商城",2);
        CatalogComponenet mall1 = new Course("商城课程1期","11");
        CatalogComponenet mall2 = new Course("商城课程2期","22");
        javaCourseLog.add(mall1);
        javaCourseLog.add(mall2);

        CatalogComponenet imoocMain = new CourseCatalog("主目录",1);
        imoocMain.add(linuxCourse);
        imoocMain.add(windowsCourse);
        imoocMain.add(javaCourseLog);

        imoocMain.print();
        //CourseCatalog、Course 都是CatalogComponenet 的子类。
    }
}
